package org.example.lost.service.impl;

import org.example.lost.entity.Image;
import org.example.lost.mapper.ImageMapper;
import org.example.lost.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @Author hxy
 * @Date 2021/3/25 8:47
 * @Version 1.0
 */
@Service
public class ImageServiceImpl implements ImageService {
    @Autowired
    ImageMapper imageMapper;

    @Override
    public int insertImage(String imageName) {
        Image image = new Image();
        image.setImageId(UUID.randomUUID().toString().replace("-",""));
        image.setImageLocation(imageName);
        int result = imageMapper.insert(image);
        return result;
    }
}
